package com.hsq.api;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class Api_ {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress localHost = InetAddress.getLocalHost();
        System.out.println(localHost);
        InetAddress inet1 = InetAddress.getByName("LAPTOP-F4JB1K09");
        System.out.println(inet1);
        InetAddress inet2 = InetAddress.getByName("www.baidu.com");
        System.out.println(inet2);
        String hostAddress = localHost.getHostAddress();
        System.out.println(hostAddress);
        String hostName = inet2.getHostName();
        System.out.println(hostName);
    }
}
